﻿#region  Copyright (C) 2013 Unisys Corporation

// =============================================================================================
// All Rights Reserved. This work contains trade secrets and confidential material of UNISYS, 
// and its use or disclosure in whole or in part without explicit written permission of 
// UNISYS is prohibited. 
//  
// Product Name          :  Unisys e-Workflow and Imaging
// File Name             :  fFields.cs
// Authored By           :  Unisys Corporation
// =============================================================================================
//	Modified by                         Date            Version
// =============================================================================================
//	ronald.aguilar@cr.unisys.com      Jun 06, 2013    Initial Version
// =============================================================================================
#endregion

#region Using Region
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Unisys.DuplicateCheck.Entity.Model;
#endregion

namespace TestSplashScreen
{
    public partial class fFields : Form
    {
        public List<IndexField> listIndex;
        public string[] fields;
        public fFields( string[] f)
        {
            
            InitializeComponent();
            fields = f;
            //dgv_Fields.Rows.Add("h");
            
        //    foreach (string fi in f)
        //    {
        //        dgv_Fields.Rows.Add(fi);
        //    }
        //    MessageBox.Show("Split");
            loadFields();
        }
        public fFields()
        {
            InitializeComponent();
           
          
        }

        private void btn_Cancel_Click(object sender, EventArgs e)
        {
            Close();
        }

        private void btn_Save_Click(object sender, EventArgs e)
        {

            if (dgv_Fields.RowCount > 1)
            {
                IndexField field;
                listIndex = new List<IndexField>();
                for (int i = 0; i < dgv_Fields.RowCount - 1; i++)
                {
                    field = new IndexField();
                    field.Name = dgv_Fields.Rows[i].Cells[0].Value.ToString();
                    listIndex.Add(field);
                }
                //MessageBox.Show("Campos indexación guardados con exito");
                this.Close();
            }
            else
            {
                this.Close();
            }

        }

        private void loadFields()
        {
            foreach (string fi in fields)
            {
                dgv_Fields.Rows.Add(fi);
            }
        }
    }
}
